package com.hdy.orderforthree.pos;

import android.content.Context;

import com.hdy.common.version.OrderVersionController;

public class ConcretePosFactory extends PosFactory {

    private static ConcretePosFactory sConcretePosFactory;

    private IPos mIPos;

    public static ConcretePosFactory getInstance() {
        if (sConcretePosFactory == null) {
            synchronized (ConcretePosFactory.class) {
                if (sConcretePosFactory == null) {
                    sConcretePosFactory = new ConcretePosFactory();
                }
            }
        }
        return sConcretePosFactory;
    }

    @Override
    public void CreatePos(String version, Context context) {
        switch (version) {
            case OrderVersionController.VERSION_FOR_EWH:
                mIPos = new DPos(context);
                 break;
            case OrderVersionController.VERSION_FOR_DGJ:
                mIPos = new DGJPos(context);
                break;
            default:
                break;
        }
    }

    public boolean isPosInited() {
        if (mIPos != null) {
            return true;
        }
        return false;
    }

    public IPos getPos() {
        return mIPos;
    }
}
